<?php
$SortByVotesArr = array('MostVotedFor' => $Context->GetDefinition('VanillVotingMostVotedFor'),
                   'MostVotedAgainst' => $Context->GetDefinition('VanillVotingMostVotedAgainst'),
                   'Neutral' => $Context->GetDefinition('VanillVotingNeutral'),
                   'All' => $Context->GetDefinition('VanillVotingAll'));

$SortByDateArr = array('24hrs' => $Context->GetDefinition('VanillVoting24hrs'),
                   '7days' => $Context->GetDefinition('VanillVoting7days'),
                   '30days' => $Context->GetDefinition('VanillVoting30days'),
                   '365days' => $Context->GetDefinition('VanillVoting365days'),
                   'All' => $Context->GetDefinition('VanillVotingAll'));

$SortByVotes = $Context->ObjectFactory->NewContextObject($Context, 'Radio');
$SortByVotes->Name = 'SortByVotes';
$SortByVotes->Attributes = ' onClick=""';
$SortByVotes->AddOptionsFromAssociativeArray($SortByVotesArr , '');
if (ForceIncomingString('SortBy','') != '') {
        $SortByVotes->SelectedID = ForceIncomingString('SortBy','');      
} else {
        $SortByVotes->SelectedID = 'All'; 
}


$SortByDate = array('MostVotedFor' => $Context->GetDefinition('MostVotedFor'),
                   'MostVotedAgainst' => $Context->GetDefinition('MostVotedAgainst'),
                   'Neutral' => $Context->GetDefinition('Neutral'));

$SortByDate = $Context->ObjectFactory->NewContextObject($Context, 'Radio');
$SortByDate->Name = 'SortByDate';
$SortByDate->Attributes = ' onClick=""';
$SortByDate->AddOptionsFromAssociativeArray($SortByDateArr , '');
if (ForceIncomingString('Date','') != '') {
        $SortByDate->SelectedID = ForceIncomingString('Date','');      
} else {
        $SortByDate->SelectedID = 'All'; 
}

$PanelString = '<h2>'.$Context->GetDefinition('VanillaVotingSortByVotes').'</h2>
<div id="VanillaVotingSortBy"><ul id ="SortByVotes"><li>'.$SortByVotes->Get().'</li></ul><h2>'.$Context->GetDefinition('VanillaVotingSortByDate').'</h2><ul id ="SortByDate"><li>'.$SortByDate->Get().'</li></ul></div>';

	// Add to controls
	$Panel->AddString($PanelString);
?>